package ${entity.packageName}.${entity.dtoPath}.dto;

<#list entity.importPackages as pkg>
import ${pkg};
</#list>

/**
 * <p>
 * ${entity.comment}
 * </p>
 *
 * @author ${entity.author}
 * @since ${.now?date}
 */
<#if entity.className?ends_with("Req")>
public class ${entity.className} extends ReqDto {
<#else>
public class ${entity.className} extends ResDto {
</#if>
    private static final long serialVersionUID = ${entity.serialVersionUID};
<#-- ----------  BEGIN 字段循环遍历  ---------->
<#list entity.fields as field>

<#if field.comment!?length gt 0>
    /**
     * ${field.comment}
     */
</#if>
<#if field.annotations??>
<#list field.annotations as anno>
    ${anno}
</#list>
</#if>
    private ${field.propertyType} ${field.propertyName};
</#list>
<#------------  END 字段循环遍历  ---------->

    public ${entity.className}() {
    }
<#if entity.fields?size==1 >
<#list entity.fields as field>

    public ${entity.className}(${field.propertyType} ${field.propertyName}) {
        this.${field.propertyName} = ${field.propertyName};
    }
</#list>
</#if>

<#list entity.fields as field>
<#if field.propertyType == "Boolean">
    <#assign getprefix="is"/>
<#else>
    <#assign getprefix="get"/>
</#if>
    /**
     * ${field.comment}
     */
    public ${field.propertyType} ${getprefix}${field.capitalName}() {
        return ${field.propertyName};
    }

<#if entity.builderModel>
    public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
<#else>
    public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
</#if>
        this.${field.propertyName} = ${field.propertyName};
<#if entity.builderModel>
        return this;
</#if>
    }

</#list>
<#if entity.constantColumn>
<#list entity.fields as field>
    public static final String ${field.name?upper_case} = "${field.name}";

</#list>
</#if>
<#if entity.fields?size!=0 >
    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("${entity.className} [");
<#list entity.fields as field>
<#if field_index==0>
        builder.append("${field.propertyName}=").append(${field.propertyName});
<#else>
        builder.append(", ${field.propertyName}=").append(${field.propertyName});
</#if>
</#list>
        builder.append("]");
        return builder.toString();
    }

</#if>
}
